<?php
if (!defined('I'))
{
	// Who is this file, relative to the root..
	define('I','../distribution/private/index.php');
}
if (!defined('ROOT'))
{
	// How is this folder related to the root?	
	define('ROOT','../framework/');
}
if (defined('FRAMEWORK_INIT'))
{
	global $account;
	global $account_state;
	global $sql_row, $sql, $sql_total;
	
	if ($_GET['action'] == 'showuser')
	{
		include('showuser.php');
	}
	else if ($_GET['action'] == 'showusers')
	{
		include('showusers.php');
	}
	else if ($_GET['action'] == 'showgame')
	{
		include('showgame.php');
	}
	else if ($_GET['action'] == 'editgame')
	{
		include('editgame.php');
	}
	else if ($_GET['action'] == 'showgames')
	{
		include('showgames.php');
	}
	else if ($_GET['action'] == 'postfeedback')
	{
		include('postfeedback.php');
	}
	else if ($_GET['action'] == 'privacy')
	{
		$keys=makedefaultkeywords();
		dopage('privacy',$keys);
	}
	else if ($_GET['action'] == 'stats')
	{
		$keys=makedefaultkeywords();
		dopage('stats',$keys);
	}
	else if ($_GET['action'] == 'tour')
	{
		$keys=makedefaultkeywords();
		dopage('tour',$keys);
	}
	else if ($_GET['action'] == 'joining')
	{
		$keys=makedefaultkeywords();
		dopage('joining',$keys);
	}
	else if ($_GET['action'] == 'license')
	{
		$keys=makedefaultkeywords();
		dopage('license',$keys);
	}
	else if ($_GET['action'] == 'at_license')
	{
		$keys=makedefaultkeywords();
		dopage('at_license',$keys);
	}
	else if ($_GET['action'] == 'legal')
	{
		$keys=makedefaultkeywords();
		dopage('legal',$keys);
	}
	else if ($_GET['action'] == 'distribution_beta_index')
	{
		include('distribution_index.php');
	}
	else
	{
		include('distribution_index.php');
	}
}
else
{
	// Simply include this file
	include(ROOT . "framework/init.php");
	include(	   "shared/defines.php");
	
	if ($_GET['action'] == 'DownloadInstaller')
	{
		include('downloadinstaller.php');
	}
	elseif ($_GET['action'] == 'pingback')
	{
		include('pingback.php');
	}
	elseif ($_GET['action'] == 'news')
	{
		include('news.php');
	}
	elseif ($_GET['action'] == 'showusers.xml')
	{
		include('showusers.xml.php');
	}
	elseif ($_GET['action'] == 'showuser_hex')
	{
		include('showuser_hex.php');
	}
	elseif ($_GET['action'] == 'statgraph')
	{		include('statgraph.php');
	}
	elseif ($_GET['action'] == 'register')
	{
		include('register.php');
	}
	else
	{
		// Set default keys, and set custom keys before the site is made.
		$keys=makedefaultkeywords();
		$keys=makekeywords('site_content_width','content',$keys);
		
		// Compile the site.
		dopage('distribution_site',$keys);
		
		// Output the site that Maxsi Framework made us, with us, by us.
		echo $output;		
	}
}
?>